package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BookshelfMapper;
import com.ruoyi.system.domain.Bookshelf;
import com.ruoyi.system.service.IBookshelfService;
import com.ruoyi.common.core.text.Convert;

/**
 * 书架管理Service业务层处理
 * 
 * @author 许雅萍
 * @date 2024-11-19
 */
@Service
public class BookshelfServiceImpl extends ServiceImpl<BookshelfMapper,Bookshelf> implements IBookshelfService

{
    @Autowired
    private BookshelfMapper bookshelfMapper;

    /**
     * 查询书架管理
     * 
     * @param id 书架管理主键
     * @return 书架管理
     */
    @Override
    public Bookshelf selectBookshelfById(Long id)
    {
        return bookshelfMapper.selectBookshelfById(id);
    }

    /**
     * 查询书架管理列表
     * 
     * @param bookshelf 书架管理
     * @return 书架管理
     */
    @Override
    public List<Bookshelf> selectBookshelfList(Bookshelf bookshelf)
    {
        return bookshelfMapper.selectBookshelfList(bookshelf);
    }

    /**
     * 新增书架管理
     * 
     * @param bookshelf 书架管理
     * @return 结果
     */
    @Override
    public int insertBookshelf(Bookshelf bookshelf)
    {
        bookshelf.setCreateTime(DateUtils.getNowDate());
        return bookshelfMapper.insertBookshelf(bookshelf);
    }

    /**
     * 修改书架管理
     * 
     * @param bookshelf 书架管理
     * @return 结果
     */
    @Override
    public int updateBookshelf(Bookshelf bookshelf)
    {
        bookshelf.setUpdateTime(DateUtils.getNowDate());
        return bookshelfMapper.updateBookshelf(bookshelf);
    }

    /**
     * 批量删除书架管理
     * 
     * @param ids 需要删除的书架管理主键
     * @return 结果
     */
    @Override
    public int deleteBookshelfByIds(String ids)
    {
        return bookshelfMapper.deleteBookshelfByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除书架管理信息
     * 
     * @param id 书架管理主键
     * @return 结果
     */
    @Override
    public int deleteBookshelfById(Long id)
    {
        return bookshelfMapper.deleteBookshelfById(id);
    }
}
